package com.inspection.constant;

import lombok.AllArgsConstructor;
import lombok.Getter;
import org.springframework.data.domain.Sort;

/**
 * @author zhaoqi
 * @since 2020-12-16
 */
@AllArgsConstructor
@Getter

public enum SortConstant {
    ASC(1,"正序", Sort.Direction.ASC),
    DESC(-1,"倒序", Sort.Direction.DESC);


    private int sort;

    private String msg;

    private Sort.Direction jpaSupport;


    public static SortConstant get(Integer sort) {
        SortConstant[] values = SortConstant.values();
        for (SortConstant value : values) {
            if(value.getSort()==sort){
                return value;
            }
        }
        return null;

    }

}
